package models;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * UserPermissionManytomanyId entity. @author MyEclipse Persistence Tools
 */
@Embeddable
public class UserPermissionManytomanyId implements java.io.Serializable {
	// Fields
	private Long userId;
	private Long permissionId;

	// Constructors

	/** default constructor */
	public UserPermissionManytomanyId() {
	}

	/** full constructor */
	public UserPermissionManytomanyId(Long userId, Long permissionId) {
		this.userId = userId;
		this.permissionId = permissionId;
	}

	// Property accessors

	@Column(name = "user_id", nullable = false)
	public Long getUserId() {
		return this.userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	@Column(name = "permission_id", nullable = false)
	public Long getPermissionId() {
		return this.permissionId;
	}

	public void setPermissionId(Long permissionId) {
		this.permissionId = permissionId;
	}

	public boolean equals(Object other) {
		if ((this == other))
			return true;
		if ((other == null))
			return false;
		if (!(other instanceof UserPermissionManytomanyId))
			return false;
		UserPermissionManytomanyId castOther = (UserPermissionManytomanyId) other;

		return ((this.getUserId() == castOther.getUserId()) || (this
				.getUserId() != null && castOther.getUserId() != null && this
				.getUserId().equals(castOther.getUserId())))
				&& ((this.getPermissionId() == castOther.getPermissionId()) || (this
						.getPermissionId() != null
						&& castOther.getPermissionId() != null && this
						.getPermissionId().equals(castOther.getPermissionId())));
	}

	public int hashCode() {
		int result = 17;

		result = 37 * result
				+ (getUserId() == null ? 0 : this.getUserId().hashCode());
		result = 37
				* result
				+ (getPermissionId() == null ? 0 : this.getPermissionId()
						.hashCode());
		return result;
	}

}